$(function () {
    if (user_data.name == undefined) {
        // alert('登陆异常', window.location.href = "login.html")
    }
    //当前登陆用户信息显示
    $("#user_main_id").text('' + user_data.name + '');
    $("#top_user_main_id").text('' + user_data.name + '');
    $("#top_main_user_img").attr('src', '' + getAliossPath("user/" + user_data.id, user_data.headimg) + '');
    $("#user_main_img").attr('src', '' + getAliossPath("user/" + user_data.id, user_data.headimg) + '');
    //用户信息详情
    let true_user_data
    let true_user_id = $_GET['user_id']
    console.log(true_user_id);
    searchUser(true_user_id)

    function searchUser(user_id) {
        $.ajax({
            url: baseURL + '/webapi/user/searchUser',
            type: 'post',
            dataType: 'json',
            headers: {'authorities': authorities},
            data: {
                id: user_id,
            },
            async: false,//同步
            success: function (data) {
                console.log(data);
                true_user_data = data.data
            }
        })
    }

    console.log(true_user_data);
    $("#item_Author_head_img").attr('user_id', '' + true_user_id + '');
    $(".name").attr('user_id', '' + true_user_id + '');
    let user_id = true_user_data.id
    let user_name = true_user_data.name
    $(".user_main_user_name").text(user_name);
    if (true_user_data.signature != null && true_user_data.signature != "") {
        $(".signature").text(true_user_data.signature);
    }
    $(".main_user_user_img").attr('src', '' + getAliossPath("user/" + true_user_data.id, true_user_data.headimg) + '');
    //用户个人页面切换
    $(".tab-item").on("click", function () {
        $(".tab-item").removeClass("active");
        $(this).addClass("active");
        $(this).show();
    });
    $(".all").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".all-item").removeClass("hide");
    });
    $(".Headlines").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".Headlines-item").removeClass("hide");
    });
    $(".article").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".article-item").removeClass("hide");
    });
    $(".img-text").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".img-text-item").removeClass("hide");
    });
    $(".video").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".video-item").removeClass("hide");
    });
    $(".micro-video").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".micro-video-item").removeClass("hide");
    });
    $(".collection").on("click", function () {
        $(".feed-list").addClass("hide");
        $(".collection-item").removeClass("hide");
    });

// 用户信息流方法
    function headlines(data) {
        let img_url = getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0)
        if (img_url == 'images/index/视角LOGO 背景.jpg?x-oss-process=image/resize,w_500') {
            $(".all-item").append(
                '            <div class="post-list-item col-sm-12 "uid="' + data.id + '" style="padding-left: 0;">\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a class="user_link" user_id="' + data.updatedBy + '"><span>\n' +
                '                            <img class="avatar user_link" user_id="' + data.updatedBy + '"  \n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        } else {
            $(".all-item").append(
                '            <div class="post-list-item col-sm-12 no_padding_left" uid="' + data.id + '">\n' +
                '                <div class="head_img fl ">\n' +
                '                    <img class="title_head_img user_img_item link" type="' + data.type + '" uid="' + data.id + '" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="" style="margin: 0">\n' +
                '                </div>\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a class="user_link" user_id="' + data.updatedBy + '"><span>\n' +
                '                            <img user_id="' + data.updatedBy + '" class="avatar user_link"\n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        }
    }

    function article(data) {
        $(".all-item").append(
            '<div class="no-mode col-sm-12"  uid="' + data.id + '">\n' +
            '    <div class="title-box col-sm-12" style="padding-left: 0;"><a class="link"  type="news"  uid="' + data.id + '">' + data.title + '</a></div>\n' +
            '    <div class="footer-bar col-sm-12" style="padding-left: 0;">\n' +
            '        <div class="footer-bar-left col-sm-10" style="padding-left: 0;">\n' +
            '            <a class="footer-bar-action tag tag-style-video" >微头条</a>\n' +
            '            <a class="footer-bar-action media-avatar" ><img user_id="' + data.updatedBy + '" class="user_link"  \n' +
            '                    src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '" alt=""></a>\n' +
            '            <a class="footer-bar-action source user_link" user_id="' + data.updatedBy + '" > ' + data.uname + '·&nbsp; </a>\n' +
            '            <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '            <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '        </div>\n' +
            '        <div class="footer-bar-right col-sm-2"></div>\n' +
            '    </div>\n' +
            '</div>'
        );
    }

    function imgtext(data) {
        $(".all-item").append(
            '<div class="ugc-mode col-sm-12" uid="' + data.id + '">\n' +
            '    <div class="col-xs-3 ugc-mode-lbox" style="padding-left: 0">\n' +
            '        <a class="img-wrap" >\n' +
            '            <img class="post-object lazy-load-img link" type="' + data.type + '" uid="' + data.id + '"  \n' +
            '                 src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '">\n' +
            '        </a>\n' +
            '    </div>\n' +
            '    <div class="col-sm-9 ugc-mode-right ugc-mode-rbox" style="padding-left: 0">\n' +
            '        <div class="col-sm-12 ugc-mode-rbox-inner" style="margin-top: 5px">\n' +
            '            <div class="ugc-mode-user">\n' +
            '                <a class="user_link" user_id="' + data.updatedBy + '"><img user_id="' + data.updatedBy + '" class="ugc-avatar user_link" src="' + getPicUrl(getAliossPath("user/" + data.updatedBy, data.headImg), 500, 0) + '" alt=""></a>\n' +
            '                <div class="ugc-desc">\n' +
            '                    <a class="ugc-name" >\n' +
            '                        <span class="user_link" user_id="' + data.updatedBy + '">' + data.uname + '</span>\n' +
            '                        <span class="dv-icon" style=";"></span>\n' +
            '                        <i class="bui-icon icon-vtt"></i>\n' +
            '                    </a>\n' +
            '                    <p class="ugc-meta">\n' +
            '                        <span>' + data.signature + '</span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-content">\n' +
            '                <a  class="link" uid="' + data.id + '">' + data.title + '</a>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-footer">\n' +
            '                <div class="footer-bar-left">\n' +
            '                    <a class="footer-bar-action source" > ' + data.uname + '·&nbsp; </a>\n' +
            '                    <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '                    <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '                </div>\n' +
            '                <div class="footer-bar-right">\n' +
            '\n' +
            '                </div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>\n' +
            '</div>\n'
        );
    }

    function video(data) {
        $(".all-item").append(
            '            <div class="post-list-item col-sm-12"style="padding-left: 0;" type="'+data.type+'" uid="' + data.id + '">\n' +
            '                <div class="head_img fl ">\n' +
            '                    <img class="title_head_img link" type="'+data.type+'" uid="'+data.id+'" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="">\n' +
            '                </div>\n' +
            '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
            '                    <a >\n' +
            '                        <div class="post-heading link" type="'+data.type+'" uid="' + data.id + '">' + data.title + '</div>\n' +
            '                    </a>\n' +
            '                    <p class="">\n' +
            '                        <a class="user_link" user_id="'+data.updatedBy+'"><span>\n' +
            '                            <img type="'+data.type+'" uid="' + data.id + '" class="avatar link"\n' +
            '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
            '                        ' + data.uname + '\n' +
            '                        </span> ⋅</a>\n' +
            '                        <span>\n' +
            '                        ' + data.commentCount + '评论\n' +
            '                        </span> ⋅\n' +
            '                        <span>\n' +
            '                                ' + time(data.atime) + '\n' +
            '                            </span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>'
        );
    }

    //分别显示方法
    function headlines_main(data) {
        let img_url = getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0)
        if (img_url == 'images/index/视角LOGO 背景.jpg?x-oss-process=image/resize,w_500') {
            $(".main_article").append(
                '            <div class="post-list-item col-sm-12 " uid="' + data.id + '" style="padding-left: 0;">\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a ><span>\n' +
                '                            <img class="avatar user_link" user_id="' + data.updatedBy + '"  \n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        } else {
            $(".main_article").append(
                '            <div class="post-list-item col-sm-12 no_padding_left" uid="' + data.id + '">\n' +
                '                <div class="head_img fl ">\n' +
                '                    <img class="title_head_img user_img_item link" type="' + data.type + '" uid="' + data.id + '" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="" style="margin: 0">\n' +
                '                </div>\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a ><span>\n' +
                '                            <img user_id="' + data.updatedBy + '" class="avatar user_link"\n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        }
    }

    function article_main(data) {
        $(".Headlines-item").append(
            '<div class="no-mode col-sm-12"  uid="' + data.id + '">\n' +
            '    <div class="title-box col-sm-12" style="padding-left: 0;"><a class="link"  type="news"  uid="' + data.id + '">' + data.title + '</a></div>\n' +
            '    <div class="footer-bar col-sm-12" style="padding-left: 0;">\n' +
            '        <div class="footer-bar-left col-sm-10" style="padding-left: 0;">\n' +
            '            <a class="footer-bar-action tag tag-style-video" >微头条</a>\n' +
            '            <a class="footer-bar-action media-avatar" ><img user_id="' + data.updatedBy + '" class="user_link"  \n' +
            '                    src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '" alt=""></a>\n' +
            '            <a class="footer-bar-action source user_link" user_id="' + data.updatedBy + '" > ' + data.uname + '·&nbsp; </a>\n' +
            '            <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '            <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '        </div>\n' +
            '        <div class="footer-bar-right col-sm-2"></div>\n' +
            '    </div>\n' +
            '</div>'
        );
    }

    function imgtext_main(data) {
        $(".img-text-item").append(
            '<div class="ugc-mode col-sm-12" uid="' + data.id + '">\n' +
            '    <div class="col-xs-3 ugc-mode-lbox" style="padding-left: 0">\n' +
            '        <a class="img-wrap" >\n' +
            '            <img class="post-object lazy-load-img link" type="' + data.type + '" uid="' + data.id + '"  \n' +
            '                 src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '">\n' +
            '        </a>\n' +
            '    </div>\n' +
            '    <div class="col-sm-9 ugc-mode-right ugc-mode-rbox" style="padding-left: 0">\n' +
            '        <div class="col-sm-12 ugc-mode-rbox-inner" style="margin-top: 5px">\n' +
            '            <div class="ugc-mode-user">\n' +
            '                <a class="user_link" user_id="' + data.updatedBy + '"><img user_id="' + data.updatedBy + '" class="ugc-avatar user_link" src="' + getPicUrl(getAliossPath("user/" + data.updatedBy, data.headImg), 500, 0) + '" alt=""></a>\n' +
            '                <div class="ugc-desc">\n' +
            '                    <a class="ugc-name" >\n' +
            '                        <span class="user_link" user_id="' + data.updatedBy + '">' + data.uname + '</span>\n' +
            '                        <span class="dv-icon" style=";"></span>\n' +
            '                        <i class="bui-icon icon-vtt"></i>\n' +
            '                    </a>\n' +
            '                    <p class="ugc-meta">\n' +
            '                        <span>' + data.signature + '</span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-content">\n' +
            '                <a  class="link" uid="' + data.id + '">' + data.title + '</a>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-footer">\n' +
            '                <div class="footer-bar-left">\n' +
            '                    <a class="footer-bar-action source" > ' + data.uname + '·&nbsp; </a>\n' +
            '                    <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '                    <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '                </div>\n' +
            '                <div class="footer-bar-right">\n' +
            '\n' +
            '                </div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>\n' +
            '</div>\n'
        );
    }

    function video_main(data) {
        $(".video-item").append(
            '            <div class="post-list-item col-sm-12"style="padding-left: 0;" type="' + data.type + '" uid="' + data.id + '">\n' +
            '                <div class="head_img fl ">\n' +
            '                    <img class="title_head_img link" type="' + data.type + '" uid="' + data.id + '" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="">\n' +
            '                </div>\n' +
            '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
            '                    <a>\n' +
            '                        <div class="post-heading link" type="' + data.type + '" uid="' + data.id + '">' + data.title + '</div>\n' +
            '                    </a>\n' +
            '                    <p class="">\n' +
            '                        <a><span>\n' +
            '                            <img user_id="' + data.updatedBy + '" class="avatar user_link"\n' +
            '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
            '                        ' + data.uname + '\n' +
            '                        </span> ⋅</a>\n' +
            '                        <span>\n' +
            '                        ' + data.commentCount + '评论\n' +
            '                        </span> ⋅\n' +
            '                        <span>\n' +
            '                                ' + time(data.atime) + '\n' +
            '                            </span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>'
        );
    }

    //收藏内容显示方法
    function headlines_collection(data) {
        let img_url = getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0)
        if (img_url == 'images/index/视角LOGO 背景.jpg?x-oss-process=image/resize,w_500') {
            $(".collection-item").append(
                '            <div class="post-list-item col-sm-12 "uid="' + data.id + '" style="padding-left: 0;">\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a class="user_link" user_id="' + data.updatedBy + '"><span>\n' +
                '                            <img class="avatar user_link" user_id="' + data.updatedBy + '"  \n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        } else {
            $(".collection-item").append(
                '            <div class="post-list-item col-sm-12 no_padding_left"uid="' + data.id + '">\n' +
                '                <div class="head_img fl ">\n' +
                '                    <img class="title_head_img user_img_item link" type="' + data.type + '" uid="' + data.id + '" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="" style="margin: 0">\n' +
                '                </div>\n' +
                '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 15px">\n' +
                '                    <a >\n' +
                '                        <div class="post-heading link" uid="' + data.id + '">' + data.title + '</div>\n' +
                '                    </a>\n' +
                '                    <p class="">\n' +
                '                        <a class="user_link" user_id="' + data.updatedBy + '"><span>\n' +
                '                            <img user_id="' + data.updatedBy + '" class="avatar user_link"\n' +
                '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
                '                        ' + data.uname + '\n' +
                '                        </span> ⋅</a>\n' +
                '                        <span>\n' +
                '                        ' + data.commentCount + '评论\n' +
                '                        </span> ⋅\n' +
                '                        <span>\n' +
                // '                                ' + time(data.atime) + '\n' +
                '                            </span>\n' +
                '                    </p>\n' +
                '                </div>\n' +
                '            </div>'
            );
        }
    }

    function article_collection(data) {
        $(".collection-item").append(
            '<div class="no-mode col-sm-12"  uid="' + data.id + '">\n' +
            '    <div class="title-box col-sm-12" style="padding-left: 0;"><a class="link"  type="news"  uid="' + data.id + '">' + data.title + '</a></div>\n' +
            '    <div class="footer-bar col-sm-12" style="padding-left: 0;">\n' +
            '        <div class="footer-bar-left col-sm-10" style="padding-left: 0;">\n' +
            '            <a class="footer-bar-action tag tag-style-video" >微头条</a>\n' +
            '            <a class="footer-bar-action media-avatar" ><img user_id="' + data.updatedBy + '" class="user_link"  \n' +
            '                    src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '" alt=""></a>\n' +
            '            <a class="footer-bar-action source user_link" user_id="' + data.updatedBy + '" > ' + data.uname + '·&nbsp; </a>\n' +
            '            <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '            <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '        </div>\n' +
            '        <div class="footer-bar-right col-sm-2"></div>\n' +
            '    </div>\n' +
            '</div>'
        );
    }

    function imgtext_collection(data) {
        $(".collection-item").append(
            '<div class="ugc-mode col-sm-12" uid="' + data.id + '">\n' +
            '    <div class="col-xs-3 ugc-mode-lbox" style="padding-left: 0">\n' +
            '        <a class="img-wrap" >\n' +
            '            <img class="post-object lazy-load-img link" type="' + data.type + '" uid="' + data.id + '"  \n' +
            '                 src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '">\n' +
            '        </a>\n' +
            '    </div>\n' +
            '    <div class="col-sm-9 ugc-mode-right ugc-mode-rbox" style="padding-left: 0">\n' +
            '        <div class="col-sm-12 ugc-mode-rbox-inner" style="margin-top: 5px">\n' +
            '            <div class="ugc-mode-user">\n' +
            '                <a ><img user_id="' + data.updatedBy + '" class="ugc-avatar user_link" src="' + getPicUrl(getAliossPath("user/" + data.updatedBy, data.headImg), 500, 0) + '" alt=""></a>\n' +
            '                <div class="ugc-desc">\n' +
            '                    <a class="ugc-name" >\n' +
            '                        <span>' + data.uname + '</span>\n' +
            '                        <span class="dv-icon" style=";"></span>\n' +
            '                        <i class="bui-icon icon-vtt"></i>\n' +
            '                    </a>\n' +
            '                    <p class="ugc-meta">\n' +
            '                        <span>' + data.signature + '</span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-content">\n' +
            '                <a  class="link" uid="' + data.id + '">' + data.title + '</a>\n' +
            '            </div>\n' +
            '            <div class="ugc-mode-footer">\n' +
            '                <div class="footer-bar-left">\n' +
            '                    <a class="footer-bar-action source" > ' + data.uname + '·&nbsp; </a>\n' +
            '                    <a class="footer-bar-action source" > ' + data.commentCount + '评论·&nbsp;</a>\n' +
            '                    <span class="footer-bar-action source time">' + time(data.atime) + '</span>\n' +
            '                </div>\n' +
            '                <div class="footer-bar-right">\n' +
            '\n' +
            '                </div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>\n' +
            '</div>\n'
        );
    }

    function video_collection(data) {
        $(".collection-item").append(
            '            <div class="post-list-item col-sm-12"style="padding-left: 0;" type="' + data.type + '" uid="' + data.id + '">\n' +
            '                <div class="head_img fl ">\n' +
            '                    <img class="title_head_img link" type="' + data.type + '" uid="' + data.id + '" src="' + getPicUrl(getAliossPath("work/" + data.id, data.tpic), 500, 0) + '" alt="">\n' +
            '                </div>\n' +
            '                <div class="" style="margin-top: 5px;display: inline-block;margin-left: 0">\n' +
            '                    <a>\n' +
            '                        <div class="post-heading link" type="' + data.type + '" uid="' + data.id + '">' + data.title + '</div>\n' +
            '                    </a>\n' +
            '                    <p class="">\n' +
            '                        <a class="user_link" user_id="' + data.updatedBy + '"><span>\n' +
            '                            <img user_id="' + data.updatedBy + '" class="avatar user_link"\n' +
            '                                 src="' + getAliossPath("user/" + data.updatedBy, data.headImg) + '">\n' +
            '                        ' + data.uname + '\n' +
            '                        </span> ⋅</a>\n' +
            '                        <span>\n' +
            '                        ' + data.commentCount + '评论\n' +
            '                        </span> ⋅\n' +
            '                        <span>\n' +
            '                                ' + time(data.atime) + '\n' +
            '                            </span>\n' +
            '                    </p>\n' +
            '                </div>\n' +
            '            </div>'
        );
    }

    //显示用户所有作品 main_content
    let pageNum = 1
    let max_data
    let sibar_data

    function all_user_content() {
        console.log(pageNum);
        $.ajax({
            url: baseURL + '/webapi/works/searchUserAllPage',
            type: 'post',
            dataType: 'json',
            headers: {'authorities': authorities},
            data: {
                user: user_id,
                // type: type,
                pageNum: pageNum,
                pageSize: 20,
            },
            async: false,//同步
            success: function (data) {
                sibar_data = data
                console.log(data);
                let data_content = data.data
                console.log(data_content);
                max_data = data_content.length
                if (max_data >= 20) {
                    max_data = 20
                }
                for (let i = 0; i < max_data; i++) {
                    if (data_content[i].type == 'headlines') {
                        headlines(data_content[i])
                        headlines_main(data_content[i])
                    } else if (data_content[i].type == 'article') {
                        article(data_content[i], '.all_item')
                        article_main(data_content[i])
                    } else if (data_content[i].type == 'imgtext') {
                        imgtext(data_content[i], '.all_item')
                        imgtext_main(data_content[i])
                    } else if (data_content[i].type == 'lvideo' || data_content[i].type == 'svideo') {
                        video(data_content[i], '.all_item')
                        video_main(data_content[i])
                    }
                }
            }
        })
    }

    all_user_content()

    //收藏内容显示
    function collection_content() {
        $.ajax({
            url: baseURL + '/webapi/works/searchUserWorkPage',
            type: 'post',
            dataType: 'json',
            headers: {'authorities': authorities},
            data: {
                // uid:user_id,
                pageNum: pageNum,
                pageSize: 20,
            },
            async: false,//同步
            success: function (data) {
                sibar_data = data
                console.log(data);
                let data_content = data.data
                console.log(data_content);
                max_data = data_content.length
                if (max_data >= 20) {
                    max_data = 20
                }
                for (let i = 0; i < max_data; i++) {
                    if (data_content[i].type == 'headlines') {
                        headlines_collection(data_content[i])
                    } else if (data_content[i].type == 'article') {
                        article_collection(data_content[i])
                    } else if (data_content[i].type == 'imgtext') {
                        imgtext_collection(data_content[i])
                    } else if (data_content[i].type == 'lvideo' && data_content[i].type == 'svideo') {
                        video_collection(data_content[i])
                    }
                }
            }
        })
    }

    collection_content()
    //触底检测
    $(document).scroll(function () {
        if ($(document).height() - $(window).height() <= $(window).scrollTop() + 500) {
            pageNum++
            if (pageNum <= (max_data / 20)) {
                all_user_content()
            }
        }
    });

    //侧边栏内容显示
    function site_bar_main_container() {
        console.log(sibar_data);
        let data = sibar_data
        console.log(data);
        let for_i_num_max
        if (data.data.length <= 3) {
            for_i_num_max = data.data.length
        } else {
            for_i_num_max = 3
        }
        //for i 循环
        for (let i = 0; i < for_i_num_max; i++) {
            if (data.data[i].tpic == null || data.data[i].tpic == "") {
                $(".article-list").append(
                    '<div class="hot_news_item">\n' +
                    '    <li class="article-item">\n' +
                    '         <a class="news-link">\n' +
                    // '            <div class="news-pic"><img class="link" type="'+data.data[i].type+'" uid="' + data.data[i].id + '" src="' + getPicUrl(getAliossPath("user/" + data.data[i].createdBy,img_symbol(data.data[i].tpic)), 500, 0) + '" alt=""></div>\n' +
                    '            <div class="news-inner" style="display: flex;align-items: center;"><p class="title link" type="' + data.data[i].type + '" uid="' + data.data[i].id + '" style="max-height: 60px;overflow : hidden;vertical-align:middle;">' + data.data[i].title + '</p></div>\n' +
                    '        </a>\n' +
                    '    </li>\n' +
                    '</div>\n'
                );
            } else {
                if (data.data[i].type != 'news') {
                    $(".article-list").append(
                        '<div class="hot_news_item">\n' +
                        '    <li class="article-item">\n' +
                        '         <a class="news-link">\n' +
                        '            <div class="news-pic"><img style="object-fit:cover;" class="link" type="' + data.data[i].type + '" uid="' + data.data[i].id + '" src="' + getPicUrl(getAliossPath("work/" + data.data[i].id, data.data[i].tpic), 500, 0) + '" alt=""></div>\n' +
                        '            <div class="news-inner"><p class="title link" type="' + data.data[i].type + '" uid="' + data.data[i].id + '" style="max-height: 60px;overflow : hidden;">' + data.data[i].title + '</p></div>\n' +
                        '        </a>\n' +
                        '    </li>\n' +
                        '</div>\n'
                    );
                } else {
                    $(".article-list").append(
                        '<div class="hot_news_item">\n' +
                        '    <li class="article-item">\n' +
                        '         <a class="news-link">\n' +
                        '            <div class="news-pic"><img style="object-fit:cover;" class="link" type="' + data.data[i].type + '" uid="' + data.data[i].id + '" src="' + getPicUrl(getAliossPath("work/" + data.data[i].tpic), 500, 0) + '" alt=""></div>\n' +
                        '            <div class="news-inner"><p class="title link" type="' + data.data[i].type + '" uid="' + data.data[i].id + '" style="max-height: 60px;overflow : hidden;">' + data.data[i].title + '</p></div>\n' +
                        '        </a>\n' +
                        '    </li>\n' +
                        '</div>\n'
                    );
                }

            }

        }

    }

    site_bar_main_container()

    //时间截取方法
    function time(time) {
        arr = (time || "").split('T');
        return arr[0]
    }

//jq end
})